<!doctype html>
<html>
<body>
This is a body
<span id="status"></span>
</body>
<script>
var error = '';
var addError = function(newError) {
  error += newError;
  var status = error.length == 0 ? 'success' : error;
  document.getElementById('status').textContent = status;
};

Object.defineProperty(Object.prototype,
                      'handleResponse',
                      {configurable: true, set: function(v) {
  addError('Intercepted handleResponse\n');
  Object.defineProperty(
      this, "handleResponse", {configurable: true, value: v});
}});

Object.defineProperty(Object.prototype,
                      "$set",
                      {configurable: true, set: function(v) {
  addError('Intercepted $set\n');
  Object.defineProperty(this, "$set", {configurable: true, value: v});
}});

Object.defineProperty(Object.prototype,
                      "clear",
                      {configurable: true, set: function(v) {
  addError('Intercepted clear\n');
  Object.defineProperty(this, 'clear', {configurable: true, value: v});
}});

// Bindings are lazily initialized. Poke it.
chrome.runtime;
// If the runtime bindings aren't created, we didn't test anything.
if (!chrome.runtime)
  addError('chrome.runtime was not created.\n');

addError('');
</script>
